<?php
$loader->requireOnce('includes/inPatientCore/InPatientCoreErrorCode.class.php');
$loader->requireOnce('includes/inPatientCore/InPatientCoreException.class.php');
$loader->requireOnce('includes/inPatientCore/InputServiceLoader.class.php');
$loader->requireOnce('ordo/InPatient.class.php');



/**
 * C_InSurgery Processor.
 * @package core.includes.inPatientCore
 * @author viethd
 * @version $Id$
 * @copyright 2009 LHV Company
 */
class C_InPatientSEBase extends Controller  {
	private $logger ;
	private $processor;


	/**
	 *
	 * @param $controller controller for build ui
	 */
	function __construct($template_mod = "general") {
		parent::Controller();
		$this->logger = LoggerManager::getLogger('core.controllers.C_InPatientSEBase');
		$this->template_mod = $template_mod;
		$this->view->path="service_input";
		$this->processor = new InPatientSEBase($this);
	}
	
    public function actionViewPatientSurgery($patientId) {
        $result = array('error'=>array('code'=>0,'mess'=>''), 'result'=>array());
        if(isset($_GET['patientId'])) {
            $patientId =   $_GET['patientId'];
        }
        $this->logger->info('Start action ViewPatientService');
        try {
            return  $this->processor->getPatientServiceList($patientId);

        } catch (InpatientCoreException $ex) {
            $result['error']['code'] = $ex->getErrorCode();
            $result['error']['mess'] = InPatientCoreErrorCode::getErrorMess($ex->getErrorCode());
            $this->logger->error('ViewPatientService fail. Error detail: '. $ex->getMessage());
        }
        $this->logger->info('Finish action ViewPatientService');
        return json_encode($result);
    }


}
?>